#!/usr/bin/env python
#==============================================================================
#
#  $Id$
#
"""
   Unit tests of dbfiles.
"""
#
#   Copyright (C) 2008 Google Inc.
#
#   This file is part of ODB.
#
#   ODB is free software: you can redistribute it and/or modify it under the 
#   terms of the GNU Lesser General Public License as published by the Free 
#   Software Foundation, either version 3 of the License, or (at your option) 
#   any later version.
#
#   ODB is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU Lesser General Public License for more details.
#
#   You should have received a copy of the GNU Lesser General Public License 
#   along with ODB.  If not, see <http://www.gnu.org/licenses/>.
#
#==============================================================================

import unittest
import fixpath
from odb import dbfile
from odb.full import FullEnv
from utils import DBTest

class TestDBFile(DBTest):
    
    def testOverflow(self):
        dbfile._FreeNodes.MAX_QUEUE = 10
        for x in range(1, 100):
            self.db[`x`] = x
        self.env.checkpoint()
        
        for x in range(1, 100, 2):
            del self.db[`x`]
        self.env.checkpoint()

unittest.main()